package edu.unlv.cs.ladders.entities;

import edu.unlv.cs.ladders.entities.Tournament;
import java.lang.SuppressWarnings;
import javax.persistence.EntityManager;
import javax.persistence.Query;

privileged aspect Team_Roo_Finder {
    
    @SuppressWarnings("unchecked")
    public static Query Team.findTeamsByTournament(Tournament tournament) {
        if (tournament == null) throw new IllegalArgumentException("The tournament argument is required");
        EntityManager em = Team.entityManager();
        Query q = em.createQuery("SELECT Team FROM Team AS team WHERE team.tournament = :tournament");
        q.setParameter("tournament", tournament);
        return q;
    }
    
}
